<template>
  <view class="top">
    <view :v-if="name" class="back-icon" @click="backOne">
      <Icon :iconName="name"/>
    </view>
    <view class="title">
      <slot name="title"/>
    </view>
  </view>
</template>

<script>

  export default {
    props: {
      name: String,
    },
    methods:{
      backOne() {
        this.$router.go(-1)
      }
    }
  };
</script>

<style lang="scss" scoped>
  .top {
    position: relative;
    text-align: center;
    padding: 8px 0;

    .back-icon {
      position: absolute;
      left: 10px;
      padding: 0 15px 0 5px;

      .icon {
        width: 24px;
        height: 24px;
      }
    }

    .title {
      font-size: 24px;
      font-weight: 700;
    }
  }
</style>
